using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollow : MonoBehaviour
{
    public Transform target;
    public float smoothing;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void LateUpdate()
    {
        if (target != null)
        {
            if (transform.position.x != target.position.x)
            {
                Vector3 targetpos = new Vector3(target.position.x, transform.position.y, transform.position.y);
                transform.position = Vector3.Lerp(transform.position, targetpos, smoothing);
            }
        }
    }
}
